<template>
	<view>
		<view class="pointsHz">
			<view>
				提现金额
				<input type="number" v-model="withdraw.money"/>
			</view>
			<view style="padding-top: 20rpx;">
				账号
				<input v-model="withdraw.account"/>
			</view>
			<view style="padding-top: 20rpx;">
				姓名
				<input  v-model="withdraw.real_name"/>
			</view>
			
			<view class="poin-1">
				<view>总余额：{{ userInfo.user_money }}元</view>
				<view @click="withdraw.money = userInfo.user_money">全部提现</view>
			</view>
		</view>
		<!-- <view class="pointsHz-i">
			<view style="font-size: 25rpx;">
				提现到
			</view>
			<view class="poin-2" @click="accountShow">
				<view>{{ label.label || '请选择提现账户' }}</view>
				<view>&GT;</view>
			</view>
		</view> -->
		<view class="pointsAn" @click="points">确认提现</view>
		<view @click="tx" class="txmx">提现明细</view>
		<view class="ts">
			<view>提现说明:</view>
			<view>1.提现手续费7％。</view>
			<!-- <view>2.提现时间:周一至周五9:00-17:30</view> -->
		</view>
		<u-select v-model="show" :list="list.type" @confirm="confirm" label-name="name"></u-select>
	</view>
</template>

<script>
	import request from '@/utils/request'
	export default {
		data() {
			return {
				list: {
					able_withdraw: 2, //可提现
					min_withdraw: '', //最小提现金额
					max_withdraw: '', //最大提现金额
					percentage: '', //提现手续百分比
					type: [] //提现类型
				},
				show:false,
				label:'',
				withdraw:{
					money:null,
					account:'',
					real_name:'',
					money_qr_code:'',
					bank:'',
					subbank:'',
					apply_remark:''
				}
			}
		},
		onLoad() {
			request.get('/withdraw/getConfig').then(res=>{
				this.list = res
				console.log(this.list);
			})
		},
		methods: {
			accountShow(){
				this.show = true
			},
			confirm(e){
				console.log(e);
				this.label = e[0]
			},
			points(){
				if(this.withdraw.money == ''){
					uni.showToast({
						title:'请输入提现金额',
						icon:'none'
					})
					return
				}
				let arr = {
					type: '6',//this.label.value, //提现类型
					money: this.withdraw.money, //提现余额
					account: this.withdraw.account, //收款账户
					real_name: this.withdraw.real_name, //真实姓名
					apply_remark: this.withdraw.apply_remark, //备注
					money_qr_code: this.withdraw.money_qr_code.toString(), //收款码
					bank: this.withdraw.bank, // 提现银行
					subbank: this.withdraw.subbank //支行银行卡
				}
				request.post('/withdraw/apply',{
					...arr
				}).then(res=>{
					console.log(res);
					uni.showToast({
						title:'申请成功'
					})
					setTimeout(()=>{
						uni.navigateBack()
					},500)
				})
			},
			tx(){
				uni.navigateTo({
					url:'/bundle/pages/withdraw_record/withdraw_record'
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.pointsHz {
		width: 673rpx;
		// height: 264rpx;
		margin: 0 auto;
		background: #FFFFFF;
		border-radius: 21rpx;
		margin-top: 70rpx;
		padding: 27rpx;
		margin-bottom: 32rpx;

		input {
			width: 620rpx;
			border-bottom: 2rpx solid #e5e5e5;
			height: 50rpx;
			margin-top: 15rpx;
		}

		.poin-1 {
			display: flex;
			justify-content: space-between;
			line-height: 4;
			font-size: 24rpx;
			color: #FF584D;

			:nth-child(1) {
				color: #999999 !important;
			}
		}
	}

	.pointsHz-i {
		width: 673rpx;
		height: 175rpx;
		margin: 0 auto;
		background: #FFFFFF;
		border-radius: 21rpx;
		margin-bottom: 56rpx;
		padding: 27rpx;

		.poin-2 {
			display: flex;
			justify-content: space-between;
			color: #999;
			margin-top: 43rpx;
			font-size: 23rpx;

			:nth-child(2) {
				font-size: 28rpx !important;
			}
		}
	}

	.pointsAn {
		width: 673rpx;
		height: 82rpx;
		background: #FF584D;
		border-radius: 41rpx;
		font-size: 32rpx;
		color: #FFFFFF;
		line-height: 82rpx;
		text-align: center;
		margin: 0 auto;
	}
	.txmx{
		width: 673rpx;
		text-align: right;
		font-size: 24rpx;
		margin: 0 auto;
		margin-top: 50rpx;
	}
	.ts{
		width: 628rpx;
		margin: 0 auto;
		font-size: 23rpx;
		color: #999999;
		margin-top: 30rpx;
		line-height: 1.5;
	}
</style>